package com.zqxq.lottery.mapper.order;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.zqxq.lottery.entity.bo.order.UserOrderBO;
import com.zqxq.lottery.entity.po.order.UserOrderPO;

import com.zqxq.lottery.entity.po.sys.LotteryHnumPO;
import com.zqxq.lottery.entity.vo.order.UserOrderVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @Description ：
 * @Author ： 解风
 * @Date ： 2018/03/13 14:39
 */
@Component(value = "userOrderMapper")
public interface UserOrderMapper extends BaseMapper<UserOrderPO> {

    List<UserOrderVO> queryPage(Page page, UserOrderBO search);

    List<UserOrderVO> queryPageApp(Page page, UserOrderBO search);

    Map<String,Object> queryOrderStatistics(Long userId);

    List<String> queryNotWinMoreThanWeeks(@Param("userId") Long userId);

    void updateOrderForClose(LotteryHnumPO po);

    void updateOrderBetForClose(LotteryHnumPO po);
    //根据订单编号取消所有投注信息
    void updateOrderBetCancel(UserOrderPO order);
    //获取所有待取消订单
    List<UserOrderPO> queryAllOrderForCancel(LotteryHnumPO po);

    UserOrderPO getTopUserOrder(@Param("userId") Long userId);

    List<Map<String,Object>> queryPrizeList(Page<Map<String,Object>> page,@Param("userId") Long userId);

    Integer getMaxOrderBetPlayType();

    Map<String,Object> queryYestoryBigPrize();

    Map<String,Object> queryMatchResult();

    List<UserOrderPO> queryDigitOrderForCal(@Param("lotteryId") Long lotteryId,@Param("period") String period);

    List<UserOrderPO> query21OrderForCal(@Param("start") Long start,@Param("end") Long end);

    List<UserOrderPO> query24OrderForCal(@Param("start") Long start,@Param("end") Long end);

    List<UserOrderPO> query210OrderForCal(@Param("start") Long start,@Param("end") Long end);

    List<UserOrderPO> query10OrderForCal(@Param("start") Long start,@Param("end") Long end);

    Long getMaxOrderId21();

    Long getMaxOrderId24();

    Long getMaxOrderId210();

    Long getMaxOrderId10();

    Long getMaxOrderIdForPrize(@Param("lotteryId") Long lotteryId);

    List<UserOrderPO> queryOrderForPrize(@Param("lotteryId") Long lotteryId);

    List<UserOrderPO> queryNotOpenPrizeOrder();

    Map<String,Object> selectPrizeInfo();

    @Select("select case when jm.match_time<=NOW() then 1 else 0 end aa from user_order_bet_21 ub left join jczq_match jm on jm.`code`=ub.period\n" +
            "where ub.order_id=#{orderId} order by jm.match_time desc limit 1")
    Integer queryIsAllOpen(@Param("orderId") String orderId);

    List<UserOrderPO> queryNearlyFourOrder(@Param("userId") Long userId);

    Integer getTodayOrderCount(Long userId);

    void disableOrderByUserId(@Param("userId") Long userId);
}
